package com.yupi.springbootinit.bizmq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.springframework.amqp.core.Exchange;

import static com.yupi.springbootinit.bizmq.BIMqConstant.*;


public class BiInitMain {

    public static void main(String[] args) {
        try {
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost("");
            factory.setUsername("");
            factory.setPassword("");

            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();
            
            String EXCHANGE_NAME = BI_EXCHANGE_NAME;
            channel.exchangeDeclare(EXCHANGE_NAME,"direct");
            
            String queueName = BI_QUEUE_NAME;
            channel.queueDeclare(queueName,true,false,false,null);
            channel.queueBind(queueName,EXCHANGE_NAME,BI_ROUTING_KEY);

        } catch (Exception e) {
            System.out.println(e.getMessage());
        }


    }


}
